package nlp;

public class FreqData implements Comparable<Object> {
	public String data;
	double frequency;

	public FreqData(String data, double frequency) {
		this.data = data;
		this.frequency = frequency;
	}

	public int compareTo(Object anotherFreqData) throws ClassCastException {
		if (!(anotherFreqData instanceof FreqData))
			throw new ClassCastException("A FreqData object expected.");
		double anotherFrequency = ((FreqData) anotherFreqData).frequency;
		return (int) (anotherFrequency - this.frequency);
	}

	public String getData() {
		return data;
	}

	public void setData(String data) {
		this.data = data;
	}

	public double getFrequency() {
		return frequency;
	}

	public void setFrequency(double frequency) {
		this.frequency = frequency;
	}
}